<%@ page pageEncoding="UTF-8"%>
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt"  prefix="fmt"%>
<style>
	.creatfolder{}
	.creatfolder p{
		font-size: 12px;
		line-height: 20px;
		color: #666;
		margin-bottom: 5px;
	}
	.creatfolder input[type=text]{
		width: 260px \0;
		*width: 260px;
		height: 30px;
		line-height: 30px;
		border: 1px solid #ccc;
	}
	.creatfolder input{
		color: #666;
		font-size: 12px;
		padding: 0 10px;
		outline: none;
	}
	.creatfolder label{
		font-size: 12px;
		color: #666;
	}
	.creatfolder button{
		width: 200px;
		height: 30px;
		line-height: 30px;
		background: #346bd0;
		text-align: center;
		color: #fff;
		border: 1px solid #346bd0;
		cursor: pointer;
		margin-top: 10px;
	}
</style>
<script src="${pageContext.request.contextPath}/views/js/libs/jquery-1.8.2.min.js"></script>
<head>
	<script type="text/javascript">
		var dialog = frameElement.dialog;
		var dialogData = dialog.get('data');
		//alert(dialogData.name);
		function createfolder(){
			var fileName = $('#fileName').val();
			if(null==fileName||fileName==''){
				alert("请填写文件夹名");
				return;
			}
			
			$.ajax({
				type : "post",
				url : "${pageContext.request.contextPath}/file/createfolder",
				data : {
					fileName:fileName,
					fileCharacter:$("input[name='fileCharacter']:checked").val(),
					filePath:$('#filePath').val(),
					"upid":$('#upid').val(),
					"seldepartid":$('#seldepartid').val()
				},
				dataType : "json",
				success : function(data) {
					if(data.code=='-1'){
						alert(data.msg);
					}
					if(data.code=='0'){
						//window.location.href="";
						parent.window.BindData();
						dialog.close();//关闭dialog 
					}
				},
				error : function() {
					alert("网络错误！");
				}
			});
			
		}
		
		
	</script>
</head>
<html>
<body>
	<input type="hidden" id="filePath" value="${filePath }">
	<input type="hidden" id="upid" value="${upid }">
	<input type="hidden" id="seldepartid" value="${seldepartid }">
	<c:if test="${fileCharacter == null ||fileCharacter == ''}"><!-- 部门的一级目录，根据角色决定文件夹类型 -->
		<c:if test="${userRole == 0}"><!-- 普通用户 -->
			<input type="hidden" id=fileCharacter value="2">
		</c:if>
		<c:if test="${userRole == 1}"><!-- 部门管理员 -->
			<input type="hidden" id=fileCharacter value="1">
		</c:if>
		<c:if test="${userRole == 2}"><!-- 超级理员 -->
			<input type="hidden" id=fileCharacter value="0">
		</c:if>
	</c:if>
	<c:if test="${fileCharacter != null&&fileCharacter != ''}">
		<input type="hidden" id=fileCharacter value="${fileCharacter }">
	</c:if>
	<table align=center class="creatfolder" width="200">
		<tr>
			<td>
				<p>请输入文件夹名：</p>
				<div>
					<input type="text" id="fileName"/>
				</div>
			</td>
		</tr>
		<tr>
			<td>
				<p style="margin-top: 10px;">选择文件夹权限：</p>
				<div>
					<input type="radio" name="fileCharacter" id="fileCharacter1" style="${grshow}" ${grcheck } value="2"/>
					<label for="fileCharacter1" style="${grshow}">个人文件夹</label>
					<input type="radio" name="fileCharacter" id="fileCharacter2"  style="${bmshow}" ${bmcheck } value="1"/>
					<label for="fileCharacter2" style="${bmshow}">部门文件夹</label>
					<input type="radio" name="fileCharacter" id="fileCharacter3"  style="${gxshow}" ${gxcheck } value="0"/>
					<label for="fileCharacter3" style="${gxshow}">共享文件夹</label>
				</div>
			</td>
		</tr>
		<tr>
			<td>
				<button onclick="createfolder();">创建</button>
			</td>
		</tr>
		
	</table>
	
	
	
	
</body>

</html>